package com.wgl.yygh.controller;

import com.wgl.model.hosp.Schedule;
import com.wgl.yygh.result.Result;
import com.wgl.yygh.serivce.ScheduleService;
import io.swagger.models.auth.In;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author wgl
 * @version 1.0.0
 * @ClassName ScheduleController.java
 * @Description TODO
 * @createTime 2022年02月07日 23:06:00
 */
@RestController
//@CrossOrigin
@RequestMapping("/admin/hosp/schedule")
public class ScheduleController {
    @Resource
    private ScheduleService scheduleService;

    /**
    * @Author: Wgl
    * @Description: 查询排班信息
    * @Date: 2022/2/8 20:36;
    * @param page: 当前页
     * @param limit: 每页记录数
     * @param hoscode: 医院编码
     * @param depcode: ; 科室编码
    * @return: com.wgl.yygh.result.Result;
    */
    @GetMapping("/getScheduleRule/{page}/{limit}/{hoscode}/{depcode}")
    public Result getScheduleRule(@PathVariable Integer page , @PathVariable Integer limit,
                                    @PathVariable String hoscode,@PathVariable String depcode) {
        Map<String,Object> map = scheduleService.getScheduleRule(page,limit,hoscode,depcode);
        return Result.ok(map);
    }
    /**
    * @Author: Wgl
    * @Description: 查询排班的详细情况
    * @Date: 2022/2/8 20:43;
    * @param workDate:  工作日期
     * @param hoscode: 医院编码
     * @param depcode: 科室编号
    * @return: com.wgl.yygh.result.Result;
    */
    @GetMapping("/getScheduleDetail/{hoscode}/{depcode}/{workDate}")
    public Result getScheduleDetail(@PathVariable String workDate,
                                    @PathVariable String hoscode,@PathVariable String depcode) {

        List<Schedule> list = scheduleService.getScheduleDetail(hoscode,depcode,workDate);
        return Result.ok(list);
    }
}
